\chapter{安全服务和安全机制(Security Services \& Mechanisms)}

\section{密码学支撑的安全服务(Security Services)}
在NIST标准“SP 800-57 Part 1 Rev. 5 Recommendation for Key Management: Part 1 – General”中对密码学支撑的安全服务进行了总结，密码技术可以支撑7种安全服务：
\begin{enumerate}
	\item 机密性Confidentiality：Confidentiality is the property whereby information is not disclosed to unauthorized parties. 

	\item 数据完整性Data Integrity：Data integrity is a property whereby data has not been modified in an unauthorized manner since it was created, transmitted or stored. Modification includes the insertion, deletion and substitution of data. 

	\item 认证Authentication：Three types of authentication services can be provided using cryptography: identity authentication, integrity authentication, and source authentication. 
		\begin{itemize}
			\item An identity authentication service is used to provide assurance of the identity of an entity interacting with a system.
			\item An integrity authentication service is used to verify that data has not been modified (i.e., this service provides integrity protection). 
			\item A source authentication service is used to verify the identity of the user or system that	created information (e.g., a transaction or message).
		\end{itemize}

	\item 授权Authorization:Authorization is concerned with providing an official sanction or permission to perform a security function or activity (e.g., accessing a room).
	
	\item 非否认性Non-reputation:In key management, non-repudiation is a term associated with digital signature keys and digital certificates that bind the name of the certificate subject to a public key.
	
	\item 支持服务Support Services:The basic cryptographic security services discussed above often require other supporting services. For example, cryptographic services often require the use of key establishment and random number generation services. Key establishment is the process by which cryptographic keys are securely established among entities using manual transport methods (e.g., key loaders), automated methods (e.g., key-transport and/or key-agreement protocols), or a combination of automated and manual methods. Random numbers are needed during the generation of cryptographic keys, challenge values and nonces (see SP 800-175B). 
	
	\item 组合服务Combining Services:In many applications, a combination of security services (e.g., confidentiality, integrity authentication, source authentication, and support for non-repudiation) is desired. Designers of secure systems often begin by considering which security services are needed to protect the information contained within and processed by the system. After these services have been	determined, the designer then considers what mechanisms will best provide these services. Not all mechanisms are cryptographic in nature. For example, physical security may be used to protect the confidentiality of certain types of data, and identification badges or biometric identification devices may be used for identity authentication. However, cryptographic mechanisms consisting of algorithms, keys, and other keying material often provide the most cost-effective means of protecting the security of information. This is particularly true in applications where the information would otherwise be exposed to unauthorized entities. 
\end{enumerate}

\section{密码算法(Cryptographic Algorithm)}
NIST SP.800-57 V.5将密码算法分为三类：
\begin{enumerate}
	\item 密码哈希函数(Cryptographic Hash Functions):Cryptographic hash functions do not require keys for their basic operation. A cryptographic hash function (also called a hash algorithm) is a cryptographic primitive that produces a condensed representation of its input (e.g., a message or other data). Common names for the output of a hash function include hash value, hash, message digest, and digital fingerprint. The maximum number of input and output bits is determined by the design of the hash function.
	\item 对称密钥算法(Symmetric-Key Algorithms) :Symmetric-key algorithms (sometimes known as secret-key algorithms) transform data in a way that is fundamentally difficult to undo without knowledge of a secret key. The key is “symmetric” because the same key is used for a cryptographic operation and its inverse (e.g., for both encryption and decryption).
	\item 非对称密钥算法(Asymmetric-Key Algorithms):Asymmetric-key algorithms, commonly known as public-key algorithms, use two related keys 
	 (i.e., a key pair) to perform their functions: a public key and a private key. The public key may be known by anyone; the private key should be under the sole control of the entity that “owns” the key pair.\footnote{Sometimes a key pair is generated by a party that is trusted by the key owner rather than by the key owner.} Even though the public and private keys of a key pair are related, knowledge of the public key cannot be used to determine the private key.
\end{enumerate}

\section{OSI 7层模型与安全服务与机制}
ISO(internet standard organization)国际标准在1989发布了一个标准“Information processing systems —— Open Systems Interconnection —— Basic Referrence Model —— Part 2 : Security Architecture”，在此标准中对安全服务、安全机制和安全服务和机制在 OSI 7 层模型中的部署情况。此标准对应我们的国标“GB/T 9387.2--1995 信息处理系统——开放系统互连——基本参考模型——第2部分: 安全体系结构”,下面的中文翻译来自GB/T 9387.\par

\subsection{安全服务(Security Services)}
9387.2标准总结了五种安全服务。
\begin{enumerate}
	\item 鉴别
		对等实体鉴别
		数据原发鉴别
		
	\item 访问控制
	
	\item 数据机密性
		\begin{enumerate}
			\item 连接机密性
			\item 无连接机密性
			\item 选择字段机密性
			\item 通信业务流机密性
		\end{enumerate}
		
		
	\item 数据完整性
		\begin{enumerate}
			\item 带恢复的连接完整性
			\item 不带恢复的连接完整性
			\item 选择字段的连接完整性
			\item 无连接完整性
			\item 选择字段无连接完整性
		\end{enumerate}
	
	\item 抗抵赖
		\begin{enumerate}
			\item 有数据原发证明的抗抵赖
			\item 有交付证明的抗抵赖
		\end{enumerate}
\end{enumerate}

\subsection{特定的安全机制(Specific security mechanisms)}
这些安全机制可以设置在适当的系统层上，提供安全服务。\par
\begin{enumerate}
	\item 加密
	\item 数字签名机制
	\item 访问控制机制
	\item 数据完整性机制
	\item 鉴别交换机制
	\item 通信业务填充机制:通信业务填充机制能用来提供各种不同级别的保护,抵抗通信业务分析。这种机制只有在通信业务填充受到机密服务保护时才是有效的。	
	\item 路由选择控制机制
	\item 公证机制(Notarization):有关在两个或多个实体之间通信的数据的性质, 如它的完整性、原发、时间和目的地等能够借助公证机制而得到确保。这种保证是由第三方公证人提供的。公证人为通信实体所信任, 并掌握必要信息以一种可证实方式提供所需的保证。每个通信事例可使用数字签名、加密和完整性机制以适应公证人提供的那种服务。当这种公证机制被用到时, 数据便在参与通信的实体之间经由受保护的通信实例和公证方进行通信。
	
\end{enumerate}

\subsection{普遍安全机制(Pervasive security mechanisms)}
普遍性安全机制不是为任何特定的服务而设定的，普遍安全机制可以认为属于安全管理方面。\par
\begin{enumerate}
	\item 可信功能度(trusted functionality)
	\item 安全标记
	\item 事件检测
	\item 安全审计跟踪
	\item 安全恢复	
\end{enumerate}

\subsection{安全服务与安全机制间关系的实例(Illustration of relationship of security services and mechanisms)}
安全服务和安全机制之间的对应关系如\ref{service-mech}所示。
\begin{table}[htbp]
	\centering 
	\caption{ 安全服务和安全机制的关系 } 
	\label{service-mech}
	\resizebox {.95\columnwidth}{!}{
	\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
		\hline 
		\diagbox{服务}{机制}  &加密  &数字签名  &访问控制    &数据完整性  &鉴别交换  &通信业务填充  &路由控制   &公证     \\ 
		\hline 
		\diagbox{Services}{Mechanism}  &Encipherment &Digital Signature &Access Control &Data Integrity  &Authentication Exchange  &Traffic Padding  &Routing Control   &Notarization     \\ 
		\hline
		对等实体鉴别           & \textbf{Y} & \textbf{Y} &$\bullet$  & $\bullet$ &\textbf{Y}  &$\bullet$ &$\bullet$  &$\bullet$    \\ 
		\hline 
		数据原发鉴别           & \textbf{Y} & \textbf{Y} & $\bullet$ & $\bullet$  &$\bullet$  &$\bullet$  &$\bullet$  &$\bullet$   \\ 
		\hline 
		访问控制服务           & $\bullet$ & $\bullet$ &\textbf{Y}  & $\bullet$ &$\bullet$  &$\bullet$ &$\bullet$  &$\bullet$    \\ 
		\hline 
		连接机密性             & $\bullet$ & \textbf{Y} & \textbf{Y} & \textbf{Y} &\textbf{Y}  &\textbf{Y} &$\bullet$  &\textbf{Y}   \\ 
		\hline 
		无连接机密性           & $\bullet$ & \textbf{Y} & \textbf{Y} & \textbf{Y} &\textbf{Y}  &\textbf{Y} &$\bullet$  &\textbf{Y}   \\ 
		\hline
		选择字段机密性         & $\bullet$ & \textbf{Y} & \textbf{Y} & \textbf{Y} &\textbf{Y}  &\textbf{Y} &\textbf{Y}  &\textbf{Y}   \\ 
		\hline
		通信业务流机密性       & $\bullet$ & \textbf{Y} & \textbf{Y} & \textbf{Y} &\textbf{Y}  &$\bullet$ &$\bullet$  &\textbf{Y}   \\ 
		\hline
		带恢复的连接完整性     & $\bullet$ & \textbf{Y} & \textbf{Y} & $\bullet$ &\textbf{Y}  &\textbf{Y} &\textbf{Y}  &\textbf{Y}   \\ 
		\hline
		不带恢复的连接完整性   & $\bullet$ & \textbf{Y} & \textbf{Y} & $\bullet$ &\textbf{Y}  &\textbf{Y} &\textbf{Y}  &\textbf{Y}   \\ 
		\hline
		选择字段连接完整性     & $\bullet$ & \textbf{Y} & \textbf{Y} & $\bullet$ &\textbf{Y}  &\textbf{Y} &\textbf{Y}  &\textbf{Y}   \\ 
		\hline
		无连接完整性           & $\bullet$ & $\bullet$ & \textbf{Y} & $\bullet$ &\textbf{Y}  &\textbf{Y} &\textbf{Y}  &\textbf{Y}   \\ 
		\hline
		选择字段无连接完整性   & $\bullet$ & $\bullet$ & \textbf{Y} & $\bullet$ &\textbf{Y}  &\textbf{Y} &\textbf{Y}  &\textbf{Y}   \\ 
		\hline
		抗抵赖, 带数据原发证据 & $\bullet$ & \textbf{Y} & $\bullet$ & \textbf{Y} &$\bullet$  &$\bullet$ &$\bullet$  &\textbf{Y}   \\ 
		\hline
		抗抵赖, 带交付证据     & $\bullet$ & \textbf{Y} & $\bullet$ & \textbf{Y} &$\bullet$  &$\bullet$ &$\bullet$  &\textbf{Y}   \\ 
		\hline
	\end{tabular} 	
	}
\\
\footnotesize{a.\textbf{Y} 表示这种机制被认为是适宜的, 或单独使用, 或与别的机制联合使用。}\\
\footnotesize{b.$\bullet$ 表示这种机制被认为是不适宜的。}\\
\end{table}

\subsection{安全服务与层的关系的实例(Illustration of the relationship of security services and layers)}
下面是OSI参考模型的7层结构每层可提供的安全服务列表，如图\ref{service-layer}所示。\par
\begin{table}[htbp]
	\centering 
	\caption{ 安全服务和层的关系 } 
	\label{service-layer}
	\resizebox {.95\columnwidth}{!}{
		\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
			\hline 
			\diagbox{服务}{层}  &1物理层  &2数据链路层  &3网络层    &4传输层  &5会话层  &6表示层  &7应用层*       \\ 
			\hline 			
			对等实体鉴别           & $\bullet$ & $\bullet$ &\textbf{Y}  & \textbf{Y} &$\bullet$  &$\bullet$ &\textbf{Y}     \\ 
			\hline 
			数据原发鉴别           & $\bullet$ & $\bullet$ &\textbf{Y}  & \textbf{Y} &$\bullet$  &$\bullet$ &\textbf{Y}     \\ 
			\hline 
			访问控制服务           & $\bullet$ & $\bullet$ &\textbf{Y}  & \textbf{Y} &$\bullet$  &$\bullet$ &\textbf{Y}      \\ 
			\hline 
			连接机密性             & \textbf{Y} & \textbf{Y} &\textbf{Y}  & \textbf{Y} &$\bullet$  &$\bullet$ &\textbf{Y}     \\ 
			\hline 
			无连接机密性           & $\bullet$ & \textbf{Y} &\textbf{Y}  & \textbf{Y} &$\bullet$  &$\bullet$ &\textbf{Y}     \\ 
			\hline
			选择字段机密性         & $\bullet$ & $\bullet$ &$\bullet$  & $\bullet$ &$\bullet$  &$\bullet$ &\textbf{Y}     \\ 
			\hline
			通信业务流机密性       & \textbf{Y} & $\bullet$ &\textbf{Y}  & $\bullet$ &$\bullet$  &$\bullet$ &\textbf{Y}     \\ 
			\hline
			带恢复的连接完整性     & $\bullet$ & $\bullet$ &$\bullet$  & \textbf{Y} &$\bullet$  &$\bullet$ &\textbf{Y}    \\ 
			\hline
			不带恢复的连接完整性   & $\bullet$ & $\bullet$ &\textbf{Y}  & \textbf{Y} &$\bullet$  &$\bullet$ &\textbf{Y}    \\ 
			\hline
			选择字段连接完整性     & $\bullet$ & $\bullet$ &$\bullet$  & \textbf{Y} &$\bullet$  &$\bullet$ &\textbf{Y}     \\ 
			\hline
			无连接完整性           & $\bullet$ & $\bullet$ &\textbf{Y}  & \textbf{Y} &$\bullet$  &$\bullet$ &\textbf{Y}   \\ 
			\hline
			选择字段无连接完整性   & $\bullet$ & $\bullet$ &$\bullet$  & $\bullet$ &$\bullet$  &$\bullet$ &\textbf{Y}   \\ 
			\hline
			抗抵赖, 带数据原发证据 & $\bullet$ & $\bullet$ &$\bullet$  & $\bullet$ &$\bullet$  &$\bullet$ &\textbf{Y}   \\ 
			\hline
			抗抵赖, 带交付证据     & $\bullet$ & $\bullet$ &$\bullet$  & $\bullet$ &$\bullet$  &$\bullet$ &\textbf{Y}  \\ 
			\hline
		\end{tabular} 	
	}
	\\
	\footnotesize{a.\textbf{Y} 表示这种机制被认为是适宜的, 或单独使用, 或与别的机制联合使用。}\\
	\footnotesize{b.$\bullet$ 表示这种机制被认为是不适宜的。}\\
	\footnotesize{c.*表示,就第7层而言，应用层进程本身可以提供安全服务。}\\
\end{table}